package org.microframework.base.feign.logs;

import org.microframework.base.core.constant.ServiceNameConstants;
import org.microframework.base.core.domain.R;
import org.microframework.base.feign.logs.factory.RemoteLogFallbackFactory;
import org.microframework.base.model.logs.domain.OperationLog;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * 日志服务
 */
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService {
    
    /**
     * 保存系统日志
     *
     * @param operLog 日志实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/log/operation")
    R<Boolean> saveLog(@RequestBody OperationLog operLog, @RequestHeader("from-source") String source);
} 